Loading in Data sets +
Library packages.
##
## The downloaded binary packages are in
## /var/folders/7n/x74qctp91rng390gx0z9hmd80000gn/T//RtmpFAX1sc/downloaded_packages
options(future.globals.maxSize = 74 * 1024^3) # 55 GB
getOption("future.globals.maxSize") #59055800320
## [1] 79456894976
load(here("jk_code", "JK_cleanMD.rds"))
Analyzing DATASET
SO4@meta.data$sample <- factor(
SO4@meta.data$sample,
levels = c("SO1","SO4","SO2","SO3"))
DimPlot(SO4,split.by ="sample",group.by = "sample")

DimPlot(SO4,group.by = "subclass2_MD",split.by = "sample")

DimPlot(SO4,group.by = "subclass_MD",split.by = "treatment")


Idents(SO4) <- "subclass2_MD"
SO.markers <- FindAllMarkers(SO4, only.pos = TRUE)
## Calculating cluster type_1
## Warning: The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
## ℹ Please use the `layer` argument instead.
## ℹ The deprecated feature was likely used in the Seurat package.
## Please report the issue at <https://github.com/satijalab/seurat/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: `PackageCheck()` was deprecated in SeuratObject 5.0.0.
## ℹ Please use `rlang::check_installed()` instead.
## ℹ The deprecated feature was likely used in the Seurat package.
## Please report the issue at <https://github.com/satijalab/seurat/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## For a (much!) faster implementation of the Wilcoxon Rank Sum Test,
## (default method for FindMarkers) please install the presto package
## --------------------------------------------
## install.packages('devtools')
## devtools::install_github('immunogenomics/presto')
## --------------------------------------------
## After installation of presto, Seurat will automatically use the more
## efficient implementation (no further action necessary).
## This message will be shown once per session
## Calculating cluster type_2
## Calculating cluster type_3
## Calculating cluster type_4
SO.markers %>%
group_by(cluster) %>%
dplyr::filter(avg_log2FC > 1)
# save as excel file
MD_degs <- SO.markers %>% arrange(desc(avg_log2FC))
write.xlsx(MD_degs, file = here("jk_code", "DEGs_MD_subclass.xlsx"), rowNames = TRUE)
SO.markers %>%
group_by(cluster) %>%
dplyr::filter(avg_log2FC > 1) %>%
slice_head(n = 10) %>%
ungroup() -> top10
DoHeatmap(SO4, features = top10$gene) + NoLegend()
## Warning in DoHeatmap(SO4, features = top10$gene): The following features were
## omitted as they were not found in the scale.data slot for the SCT assay: Rsad2,
## Gbp9, Ifi47


DimPlot(SO4,split.by = "sample")

Markers for each
type
type_1 <- c("Pappa2","Pde10a","Mcub","Ramp3")
VlnPlot(SO4,type_1)
## Warning: The `slot` argument of `FetchData()` is deprecated as of SeuratObject 5.0.0.
## ℹ Please use the `layer` argument instead.
## ℹ The deprecated feature was likely used in the Seurat package.
## Please report the issue at <https://github.com/satijalab/seurat/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

type_2 <- c("Egf","Krt7")
VlnPlot(SO4,type_2)

type_3 <- c("Fos","Socs3","Fosb","Junb")
VlnPlot(SO4,type_3)

type_4 <- c("Cxcl10","Isg15")
VlnPlot(SO4,type_4)

type_markers <- c(type_1,type_2,type_3,type_4)
DotPlot(SO4,
features = type_markers,
dot.scale = 8,
dot.min = 0,
scale = FALSE,
scale.max = 100,
scale.min = 0,
col.min = -2.5,
col.max = 2.5)+
coord_flip()
